package com.bz.order.config;

import com.bz.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class AdviceControllerConfig {

    private static Logger logger = LoggerFactory.getLogger(AdviceControllerConfig.class);

    @ExceptionHandler(Exception.class)
    public Result handleException(Exception ex){
        //log.error("系统异常：{}",ex);
        logger.error("系统异常：{}",ex);// 输出到 logstash，在通过 logstash 输出到 elk 中
        return Result.error("系统异常");
    }
}
